﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKArchUtils.Utils;
using YJKElementFinish.MultiWallEdit.Controller;
using YJKRevitView;

namespace YJKElementFinish.MultiWallEdit
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdMergeWall : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			CmdViewType types = (CmdViewType)17;
			if (SwitchView.SetUsableView(types, cmdData) != Autodesk.Revit.UI.Result.Succeeded)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			HideWarningAndErroringKit @object = new HideWarningAndErroringKit(new List<string>
			{
				"merge wall",
				"flip wall",
				"delete old walls"
			}, HideWarningAndErroringKit.HideKitEnum.HideWarning);
			cmdData.Application.Application.FailuresProcessing += @object.OnFailuresProcessingDelAllWaring;
			return new WallMergeController(cmdData).Merge();
		}
	}
}
